#ifndef SWP_JOIN_GRAPHIC_ITEM_H
#define SWP_JOIN_GRAPHIC_ITEM_H

#include "abstractpolygongraphicitem.h"

namespace swp
{

class SwpJoinGraphicItem : public AbstractPolygonGraphicItem
{
public:
    SwpJoinGraphicItem(QGraphicsItem* parent = 0);
    virtual ~SwpJoinGraphicItem();

    // IEditorItem
    virtual bool supportsConnection(
        const core::ConnectionData& connection) const;

    int type() const;

    QString name() const;

    IEditorItem* copy() const;

    // IPropertyObject
    QList<core::Property> properties() const;

    QVariant propertyValue(const QString& propertyName) const;

    void propertyChanged(const QString& property,
        const QVariant& newValue, bool silent = false);

    QVariantList optionList(const QString& propertyName) const;
    QVariantList autocomplete(const QString& propertyName) const;

protected:
    // AbstractPolygonGraphicItem
    QList<QPointF> scalePoints() const;
    QList<QPointF> connectPoints() const;
    QList<QPointF> connectPointsForIncoming() const;
    QList<QPointF> connectPointsForOutgoing() const;
    QList<QPointF> selfConnectAnchorPoints() const;
    QList<int> selfConnectAnchorMappings() const;

    int paletteType() const;

private:
    bool containsSameConnection(const core::ConnectionData& connection,
        const QList<core::ConnectionData>& connections) const;

    int outgoingConnectionSize(
        const QList<core::ConnectionData>& connections) const;

    int incomingConnectionSize(
            const QList<core::ConnectionData>& connections) const;
};

} // namespace swp

#endif
